<template>
	<view class="add-project-box" :style="'padding-top:'+(barHeight)+'px'">
		<NavBar>
			<template v-slot:center>
				<view class="nav_center">
					新增项目
				</view>
			</template>
			<template v-slot:left>
				<text class="cancel-add" @click="cancelAdd">取消</text>
			</template>
		</NavBar>
		<view class="">
			<AddProjectBaseInfo :flag="type" :id="id"></AddProjectBaseInfo>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import AddProjectBaseInfo from './AddProjectBaseInfo.vue'
	export default {
		components: {
			NavBar,
			AddProjectBaseInfo
		},
		data() {
			return {
				type: 0,
				id: '',
				barHeight: 0,
			}
		},
		onLoad(option) {
			this.id = option.id
		},
		created() {
			this.barHeight = uni.getSystemInfoSync().statusBarHeight + 45 + 10;
		},
		beforeCreate() {
			uni.$on('reloadAddProject', () => {
				uni.$emit('reloadProjectList')
			})
		},
		destroyed() {
			uni.$off('reloadAddProject')
		},
		methods: {
			cancelAdd() {
				uni.$emit('reloadProjectList')
			}
		}
	}
</script>

<style>
	@import '../../../static/css/commons.css';
</style>